% this code scatterplots the ranks of sectors
% especially ranks under cases 1 and 4
% for 341 sectors


cd(fullfile(wd, 'Figure1')); 

% join together the relevant cases by industry
% 341 sectors
filename1 = ['Table5c_case_1_params1_341.csv'];
filename2 = ['Table5c_case_4_params1_341.csv'];
ds1=csvread(filename1)
A1 = array2table(ds1, 'VariableNames', {'industry','rank1'});
ds1=csvread(filename2)
A4 = array2table(ds1, 'VariableNames', {'industry','rank2'});
ranks_341 = join(A1,A4)

cd(fullfile(wd, 'Figure3')); 

% 341 sectors
ranks_341=table2array(ranks_341(:,:))
figure()
    scatter(ranks_341(:,2), ranks_341(:,3),'b')
    xlabel('\textbf{Sectoral Rank in Case 1, All Sectors}','Interpreter','latex')
    ylabel('\textbf{Sectoral Rank in Case 4}','Interpreter','latex')
    fig341 = gcf
    fig341.PaperUnits = 'normalized';
    fig341.PaperPosition = [0 0 1 .6];
    fig341.PaperPositionMode = 'manual';
    filename = ['Sectoral_ranks_cases_4_and_1_341_sectors.eps'];
    saveas(fig341,filename,'epsc');
    filename = ['Sectoral_ranks_cases_4_and_1_341_sectors.pdf'];
    saveas(fig341,filename);

